/*
1324 1423
13254 14253 15324 15423

*/

#include <algorithm>
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <vector>
using ll = int64_t;

int main(){
    return 0;
    for(ll i=3;i<=6;i++){
        printf("[%lld]\n",i);
        static std::vector<ll> v;
        v.clear();
        v.resize(i);
        for(ll i=0;i<v.size();i++)v[i]=i+1;
        ll sum=0;
        while (std::next_permutation(v.begin(),v.end())) {
            if(v[0]!=1)continue;
            ll now=-1;
            if(v[0]<v[1])now=1;
            else now=0;
            for(ll i=2;i<v.size();i++){
                if((now==1&&v[i-1]<v[i]) || (now==0&&v[i-1]>v[i])){
                    goto next;
                }else{
                    if(v[i-1]<v[i])now=1;
                    else now=0;
                }
            }
            for (ll i=0; i<v.size(); i++) {
                std::cout<<v[i]<<" ";
            }
            std::cout<<'\n';
            sum++;
            next:;
        }
        printf("sum: %lld\n",sum);
    }
}